{extend name="template/base" /}
{block name='style'}
<style>
	*{
		padding:0px;
		margin:0px;
	}
	.main{
		/*width:90%;*/

		height:200px;
		padding:20px;
		margin:0 auto;
	}
	.img{
		/*width:800px;*/
		/*height:150px;*/

		margin:0 auto;
		font-size:20px;
		font-weight: bold;
		color:#ddd;
	}
	.del{
		width:400px;
		height:30px;
		background: #ddd;
		color:#f00;
		text-align: center;
		cursor:pointer;
		opacity:0.5;
	}
	.imglist{
		float:left;
		margin:10px 5px;
	}
	.clear{
		clear:both;
	}
</style>
{/block}
{block name="nav"}

{/block}
{block name='content'}
<div class="main">
	<div class='img'>
		{volist name='list' id='vo' empty='暂无图片'}
		<div class="imglist">
			<img src="/uploads/renzheng/{$vo.img}" alt="" width='400' height='250'>
			<div class='del' data-index="{$vo.id}">
				删除
			</div>

		</div>
		
		{/volist}
		<div class="clear"></div>
	</div>	
</div>
{/block}
{block name='script'}
<script>
	width=$('.img').css('width');
	width=width.substr(0,width.length-2);
	width=width-78;
	$('.img').css('width',width+'px');

	$('.del').click(function(){
		if(!confirm('您确定要删除吗')){
			layer.msg('已取消');
			return false;
		}
		obj=$(this);
		id=obj.data('index');
		$.post("{:url('Service/del_upload_img')}",{'id':id},function(r){
			if(r==1){
				obj.parent().remove();
				layer.msg('删除成功');
			}else{
				layer.msg('稍后再试');	
			}
		})
		
	});

</script>
{/block}
